package com.elektronikforumet.camalert;

import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.RectF;
import android.graphics.Paint.Style;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.Projection;

public class MyPosOverlay extends Overlay {
	GeoPoint geoPoint;
    static int w, h;
    int rotDegrees;
    /*
	public MapCamOverlay(Drawable dr, GeoPoint gp) {

	}
	*/
	
    public MyPosOverlay(GeoPoint p, int rotDegrees) {
        this.geoPoint = p;
        this.rotDegrees = rotDegrees;
    } 
    
    public void draw(Canvas canvas, MapView mapView, boolean shadow) {
    	Projection projection = mapView.getProjection();

    	if (shadow == false) {
    		Paint paint = new Paint();
    		paint.setARGB(250, 255, 0, 0);
    		paint.setAntiAlias(true);
    		paint.setFakeBoldText(true);
    		paint.setStyle(Style.STROKE);
    		paint.setStrokeWidth(4);
    		Point myPoint = new Point();    		
    		projection.toPixels(geoPoint, myPoint);

    		int rad = 10;
    		RectF oval = new RectF(myPoint.x-rad, myPoint.y-rad,
    				myPoint.x+rad, myPoint.y+rad);
    		
    		// Draw on the canvas
    		canvas.drawOval(oval, paint);

    		//canvas.drawText("", myPoint.x+rad, myPoint.y, paint);
    	}
    }
    
}
